/**
 * 
 */
package fecat.thread;

import java.util.Date;

import com.anh.oddy.client.message.TradeResponse;

import fecat.eventcenter.EventArgs;
import fecat.eventcenter.EventManager;
import fecat.services.log.LoggingService;
import fecat.services.server.TradeService;

/**
 * @author ibm
 *
 */
public class TradeThread extends Thread {
	public void run(){
		try{
			while(true){
				TradeResponse response=TradeService.popTradeResponse();
	            String service = response.getService();
	            String trcode = response.getTrcode();
	            String data = response.getData();
//	            if(!trcode.equals("9999")){
//	            	Date date=new Date();
//	            	LoggingService.info(date.toLocaleString()+":recive---"+service+":"+trcode+":"+data);
//	            }
	            EventArgs arg=new EventArgs();
				arg.setEventName(trcode);
				arg.setEventParm(response);
				EventManager.sendServerMessager(arg);
			}
		}
		catch(Exception ex){
			LoggingService.error(ex);
		}
		
	}
}
